/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.patient;

import entities.PatientDetails;
import java.util.ArrayList;
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;

/**
 *
 * @author VietLH
 */
public class PatientComboBoxModel implements ComboBoxModel{
     private ArrayList<PatientDetails> patientList;
    private PatientDetails selection;

    public PatientComboBoxModel(ArrayList<PatientDetails> patientList) {
        this.patientList=new ArrayList<PatientDetails>();
        this.selection=new PatientDetails(0, "- Select a patient -", "", "", "", true, null);
        this.patientList=patientList;
    }
    
    
    @Override
    public void setSelectedItem(Object anItem) {
        selection= (PatientDetails)anItem;
//        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Object getSelectedItem() {
        return selection;
//        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getSize() {
        return patientList.size();
//        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Object getElementAt(int index) {
        return patientList.get(index);
//        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void addListDataListener(ListDataListener l) {
//        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void removeListDataListener(ListDataListener l) {
//        throw new UnsupportedOperationException("Not supported yet.");
    }
}
